unit RResumoOperacional;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RLReport, TeEngine, Series, ExtCtrls, TeeProcs, Chart, DbChart;

type
  TFormRResumoOperacional = class(TForm)
    RLReport1: TRLReport;
    RLBand1: TRLBand;
    RLImage1: TRLImage;
    RLGroup1: TRLGroup;
    RLBand2: TRLBand;
    RLBand3: TRLBand;
    RLDBText1: TRLDBText;
    RLDBText2: TRLDBText;
    RLLabel2: TRLLabel;
    RLLabel1: TRLLabel;
    RLBand4: TRLBand;
    RLDBText4: TRLDBText;
    RLDBText5: TRLDBText;
    RLDBText6: TRLDBText;
    RLLabel6: TRLLabel;
    RLLabel7: TRLLabel;
    RLLabel3: TRLLabel;
    RLBand5: TRLBand;
    RLPanel1: TRLPanel;
    DBChart1: TDBChart;
    Series1: TPieSeries;
    procedure RLReport1BeforePrint(Sender: TObject; var PrintIt: Boolean);
    procedure RLDBText1BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
    codcliente,mes,ano : integer;
  end;

var
  FormRResumoOperacional: TFormRResumoOperacional;

implementation

uses DMR, DMS, Geral, DB;

{$R *.dfm}

procedure TFormRResumoOperacional.RLReport1BeforePrint(Sender: TObject;
  var PrintIt: Boolean);
begin
    DBChart1.Handle;
    DMSr.dsEmpresaProp.DataSet.Open;
    if (GetParametro('LOGO') <> '') and ((pos('BMP',UpperCase(GetParametro('LOGO'))) > 0) or (pos('JPG',UpperCase(GetParametro('LOGO'))) > 0))then
        RLImage1.Picture.LoadFromFile(GetParametro('LOGO'));
    with DMRel.QueryRGraficoAnomalia do
    begin
        close;
        parambyname('pmes').Asinteger := mes;
        parambyname('pano').Asinteger := ano;
        parambyname('pcodcliente').Asinteger := codcliente;
        open;
        while not DMRel.QueryRGraficoAnomalia.Eof do
        begin
            DBChart1.Series[0].Add(FieldByName('QUANTIDADE').AsInteger,  GetCampoQuery('OCORRENCIA','DESCRICAO','CODOCORRENCIA',FieldByName('CODOCORRENCIA').AsString));
            next;
        end;
        CLOSE;
    end;      
end;

procedure TFormRResumoOperacional.RLDBText1BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    if Text = 'NCV' then
        Text := Text+'*';
end;

end.
